let config = {
    Appid: '',
    sign_key: '',
    TokenKey: '',
    requestHeader:{},
    requestError:{
        '410': (res)=>{
            rError(res)
        },
        error: (res)=>{
            rError(res)
        }
    },
    routerCall:(ops)=>{
        console.log(ops)
    }
}


function init(option = {}) {
    let { Appid, sign_key } = option;
    if (!Appid) {
        new Error(`Appid Can not be empty`)
        return
    } else if (!sign_key) {
        new Error(`sign_key Can not be empty`)
        return
    }
    config = {
        ...config,
        ...option
    }
}

function getConfig() {
    return config
}


const rError = (res) => {
    uni.showToast({ title: res.msg, icon: 'none' });
  }

module.exports = {
    init,
    getConfig
}